{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# RASA 项目简介\n",
    "\n",
    "\n",
    "## 理解 RASA Pipeline\n",
    "\n",
    "RASA NLU 做的是 NLU **工程**， 不是开发 NLU 算法。以下是 RASA 的一个重要概念 Pipeline. \n",
    "\n",
    "```\n",
    "  - name: \"MitieNLP\"                                         // 中文语料, NLP 模型\n",
    "    model: \"data/total_word_feature_extractor_zh.dat\"\n",
    "  - name: \"JiebaTokenizer\"                                   // 分词\n",
    "  - name: \"MitieEntityExtractor\"                             // Entity 提取\n",
    "  - name: \"EntitySynonymMapper\"                              // 近义词\n",
    "  - name: \"CountVectorsFeaturizer\"                           // 特征化\n",
    "  - name: \"EmbeddingIntentClassifier\"                        // 分类器\n",
    "```\n",
    "\n",
    "## Training Pipeline \n",
    "这里也可以看到Rasa NLU的工作流程。`nlp_mitie` 初始化MITIE，`tokenizer_jieba`用 **jieba** 来做分词，\n",
    "`ner_mitie` 和 `ner_synonyms` 做实体识别，`intent_featurizer_mitie` 为意图识别做特征提取，\n",
    "`intent_classifier_sklearn` 使用 **sklearn** 做意图识别的分类。\n",
    "\n",
    "```yaml\n",
    "pipeline:\n",
    "  - name: \"MitieNLP\"\n",
    "    model: \"data/total_word_feature_extractor.dat\"\n",
    "  - name: \"JiebaTokenizer\"\n",
    "  - name: \"MitieEntityExtractor\"\n",
    "  - name: \"EntitySynonymMapper\"\n",
    "  - name: \"MitieFeaturizer\"\n",
    "  - name: \"SklearnIntentClassifier\"\n",
    "```\n",
    "\n",
    "`SklearnIntentClassifier` 不会使用GPU，如果使用GPU,建议使用以下Pipeline\n",
    "```yaml\n",
    "pipeline:\n",
    "  - name: \"MitieNLP\"\n",
    "    model: \"data/total_word_feature_extractor_zh.dat\"\n",
    "  - name: \"JiebaTokenizer\"\n",
    "  - name: \"MitieEntityExtractor\"\n",
    "  - name: \"EntitySynonymMapper\"\n",
    "  - name: \"CountVectorsFeaturizer\"\n",
    "  - name: \"EmbeddingIntentClassifier\"\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
